Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly warn if food will cause you to overeat #74318

Merged
merged 5 commits into from
Jun 15, 2024

Conversation

RenechCDDA
Copy link
Member

Summary

Bugfixes "Properly warn if food will cause you to overeat"

Purpose of change

Same reason as #74149, make camp meals not stuff your face without warning

Character::will_eat and Character::update_stomach had different ideas about when the stomach was full

Describe the solution

Take them out to a nice foodplace™ dinner so they can sort out their differences (new function, both of them use it. one source of truth)

Also updated the camp menu while I was here so you can choose how you stuff your piehole. Please eat responsibly, even ingame.

Describe alternatives you've considered

units::volume in_stomach_volume = food.volume() * compute_effective_food_volume_ratio( food );
I bet there's other places that should be using this, I just haven't found them yet

Testing

(After first commit, before second commit):
https://github.com/CleverRaven/Cataclysm-DDA/assets/84619419/92ada55c-5231-47ab-bbf1-4cc265617d18

Additional context

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` Player Faction Base / Camp All about the player faction base/camp/site <Bugfix> This is a fix for a bug (or closes open issue) astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Jun 4, 2024
@RenechCDDA
Copy link
Member Author

...I have no idea how that test failure has happened, but it seems like it may be related. Let's roll the dice (re-run the test) anyway!

@Kamejeir
Copy link
Contributor

Kamejeir commented Jun 5, 2024

image
this result from consumption of water via a water tank (with 230 units of water) has me believing that in_stomach_volume takes into account the combined volume of all water available to the faucet, not just the amount expected to be consumed.

by placing only one unit of water (which would fit into a stomach) in the tank, the prompt for being too full disappears. I'm going to try making a local edit to the test with an immediately drinkable amount of water and see if it succeeds

edit:
that didn't succeed, but I found that dividing food.volume() with food.charges_per_volume( food.volume() ) makes it behave better

edit 2:
food.volume() is supposed to get the volume of a single charge, so I'm going to look at if the vehicle code does anything weird (I don't know, like, define 50 liters of water as a single charge)

edit 3:
food.volume() actually needs arguments to look for the volume of a single charge. food.volume( false, false, 1 ) gets the volume of that (1) charge, and it is successful in local the unit test "faucet_offers_cold_water"

src/consumption.cpp Outdated Show resolved Hide resolved
src/consumption.cpp Outdated Show resolved Hide resolved
@RenechCDDA RenechCDDA force-pushed the overeating_is_bad branch from 60472f0 to cd5fda7 Compare June 6, 2024 22:31
@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions and removed astyled astyled PR, label is assigned by github actions labels Jun 6, 2024
@github-actions github-actions bot added BasicBuildPassed This PR builds correctly, label assigned by github actions and removed BasicBuildPassed This PR builds correctly, label assigned by github actions labels Jun 15, 2024
@dseguin dseguin merged commit 3ae753b into CleverRaven:master Jun 15, 2024
19 of 26 checks passed
@RenechCDDA RenechCDDA deleted the overeating_is_bad branch June 17, 2024 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions Player Faction Base / Camp All about the player faction base/camp/site
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants